import showMsg from '../utils/errmsg'
import { httpHeader } from './../utils/http'
export const state = () => {
    return {
    }
}
const httpObject = {
    transformRequest: [(params) => {
        let result = ''
        Object.keys(params).forEach((key) => {
          if (!Object.is(params[key], undefined) && !Object.is(params[key], null)) {
            result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'
          }
        })
        return result
    }],
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    }
}
export const mutations = {
}

export const getters = {
}

export const actions = {
    // 货源分类列表查询
    async infoGoodsGetCargoByType({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoCargomaster/open/getCargoByType', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //车源分类列表查询
    async infoCarGetCargoByType({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoVehicleinfo/open/getVehicleinfoList', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 智能推荐车源列表查询
    async infoRecomGetCargoByType({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoVehicleinfo/open/getElectVehicleinfoList', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 线路列表查询
    async lineGetSelectLines({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/line/open/getSelectLines', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 线路热门查询
    async lineGetLinesHot({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/line/open/getLines', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 货源详情接口
    async supplyGetCargosmasterById({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoCargomaster/open/getCargosmasterById/'+payload, { params: {} }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
     // 智能推荐货源列表查询
    async infogoodsGetCargoByType({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoCargomaster/open/getElectCargoByType', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
     // 货源其他产品接口
    // async supplyGetOtherrById({ commit, dispatch }, payload) {        
    //     try {
    //         const response = await this.$axios.$get('/api/info/infoCargomaster/open/getCompanyCargosmasterById/'+payload, { params: {} }, httpHeader)
    //         response.status = response.code === '0000'
    //         if (!response.status) showMsg(response.msg, response.code, dispatch)
    //         return response
    //     } catch (err) {
    //         err.status = false
    //         return err
    //     }
    // },
   async supplyGetOtherrById({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoCargomaster/open/getCompanyCargosmasterById', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //车源详情接口
    async carGetCargosmasterById({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoVehicleinfo/open/getVehicleinfoDeTail/'+payload, { params: {} }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
     //车源其他产品接口
    // async carGetOthherById({ commit, dispatch }, payload) {        
    //     try {
    //         const response = await this.$axios.$get('/api/info/infoVehicleinfo/open/getCompanyVehicleinfoLists/'+payload, { params: {} }, httpHeader)
    //         response.status = response.code === '0000'
    //         if (!response.status) showMsg(response.msg, response.code, dispatch)
    //         return response
    //     } catch (err) {
    //         err.status = false
    //         return err
    //     }
    // },
    async carGetOthherById({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoVehicleinfo/open/getCompanyVehicleinfoLists', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },

   // 线路列表详情查询
   async lineById({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/line/open/getLineById/'+payload, { params: {} }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //线路中的其他产品信息
    async lineOtherById({ commit, dispatch }, payload) {        
            try {
                const response = await this.$axios.$get('/api/info/line/open/getCompanySelectLines', { params: payload }, httpHeader)
                response.status = response.code === '0000'
                if (!response.status) showMsg(response.msg, response.code, dispatch)
                return response
            } catch (err) {
                err.status = false
                return err
            }
    },


    //详情页联系我们、公司简介
     async concatUserID({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/userinfo/open/'+payload, { params: {} }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //联系方式
    async concatUserName({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/userinfo/open/username/'+payload, { params: {} }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //查询招标物流信息列表
     async logisticsTenderees({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/logisticsTenderee/open/getOpenLogisticsTendereeList', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 其他招标信息
    async otherLogisticsTenderees({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/logisticsTenderee/open/findTenderees', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 公司其他中标信息
     async tenderscs({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/logisticsTenderee/open/getCompanyLogisticsTendereeLists', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
     //查询中标物流信息列表
     async findBidsList({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/logisticsBid/open/findBids', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //查询中标物流信息详情列表
    async tofindBidById({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/logisticsTenderee/open/getOpenLogisticsTendereeDetaill/'+payload, { params: {} }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //修改留言信息（立即询价提交接口）
    async submitMessage({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$post('/api/message/internalMessage/send/messageBoard', payload )
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 立即评价接口
    async evaluationInterface({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$post('/api/info/infoEvaluate', payload)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    // 全部评论列表数据接口
     async allEvalList({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/infoEvaluate', { params: payload },httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
     //查询绿色食品供应列表
     async sellOfferList({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/greenFoodSupply/open', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
    //查询农产品供应列表
    async villageList({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/agricultureSupply/open/getOpenAgricultureSupplyList', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
        //查询农产品采购列表
        async agriculList({ commit, dispatch }, payload) {        
            try {
                const response = await this.$axios.$get('/api/info/agriculturePurchase/open/getOpenAgriculturePurchaseList', { params: payload }, httpHeader)
                response.status = response.code === '0000'
                if (!response.status) showMsg(response.msg, response.code, dispatch)
                return response
            } catch (err) {
                err.status = false
                return err
            }
        },
 
        // 绿色食品供应详情接口
        async sellOfferListById({ commit, dispatch }, payload) {        
            try {
                const response = await this.$axios.$get('/api/info/greenFoodSupply/open/getGreenFoodSupplyDeTail/'+payload, { params: {} }, httpHeader)
                response.status = response.code === '0000'
                if (!response.status) showMsg(response.msg, response.code, dispatch)
                return response
            } catch (err) {
                err.status = false
                return err
            }
        },
                // 农产品供应详情接口
                async villageListById({ commit, dispatch }, payload) {        
                    try {
                        const response = await this.$axios.$get('/api/info/agricultureSupply/open/getAgricultureSupplyDeTail/'+payload, { params: {} }, httpHeader)
                        response.status = response.code === '0000'
                        if (!response.status) showMsg(response.msg, response.code, dispatch)
                        return response
                    } catch (err) {
                        err.status = false
                        return err
                    }
                },
                             // 农产品采购详情接口
                             async agriculListById({ commit, dispatch }, payload) {        
                                try {
                                    const response = await this.$axios.$get('/api/info/agriculturePurchase/open/getAgriculturePurchaseDetail/'+payload, { params: {} }, httpHeader)
                                    response.status = response.code === '0000'
                                    if (!response.status) showMsg(response.msg, response.code, dispatch)
                                    return response
                                } catch (err) {
                                    err.status = false
                                    return err
                                }
                            },
                //绿色的其他产品信息
                async greenOtherById({ commit, dispatch }, payload) {        
                    try {
                        const response = await this.$axios.$get('/api/info/greenFoodSupply/open/getGreenFoodSupplyOtherList/'+payload, { params: {} }, httpHeader)
                        response.status = response.code === '0000'
                        if (!response.status) showMsg(response.msg, response.code, dispatch)
                        return response
                    } catch (err) {
                        err.status = false
                        return err
                    }
            },
                //农产品供应的其他产品信息
                            async villageOtherById({ commit, dispatch }, payload) {        
                                try {
                                    const response = await this.$axios.$get('/api/info/agricultureSupply/open/getCompanyAgricultureSupplyById', { params: payload}, httpHeader)
                                    response.status = response.code === '0000'
                                    if (!response.status) showMsg(response.msg, response.code, dispatch)
                                    return response
                                } catch (err) {
                                    err.status = false
                                    return err
                                }
                        },
                                        //农产品采购的其他产品信息
                                        
                                        async agriculOtherById ({ commit, dispatch }, payload) {        
                                            try {
                                                const response = await this.$axios.$get('/api/info/agriculturePurchase/open/getCompanyAgriculturePurchaseById', { params: payload}, httpHeader)
                                                response.status = response.code === '0000'
                                                if (!response.status) showMsg(response.msg, response.code, dispatch)
                                                return response
                                            } catch (err) {
                                                err.status = false
                                                return err
                                            }
                                    },
                 //查询绿色食品采购列表
     async buyOfferList({ commit, dispatch }, payload) {        
        try {
            const response = await this.$axios.$get('/api/info/greenFoodPurchase/open', { params: payload }, httpHeader)
            response.status = response.code === '0000'
            if (!response.status) showMsg(response.msg, response.code, dispatch)
            return response
        } catch (err) {
            err.status = false
            return err
        }
    },
        // 绿色食品采购详情接口
        async buyOfferListById({ commit, dispatch }, payload) {        
            try {
                const response = await this.$axios.$get('/api/info/greenFoodPurchase/open/getGreenFoodPurchaseDeTail/'+payload, { params: {} }, httpHeader)
                response.status = response.code === '0000'
                if (!response.status) showMsg(response.msg, response.code, dispatch)
                return response
            } catch (err) {
                err.status = false
                return err
            }
        },
                //绿色的采购其他产品信息
                async buygreenOtherById({ commit, dispatch }, payload) {        
                    try {
                        const response = await this.$axios.$get('/api/info/greenFoodPurchase/open/getGreenFoodSupplyOtherList/'+payload, { params: {} }, httpHeader)
                        response.status = response.code === '0000'
                        if (!response.status) showMsg(response.msg, response.code, dispatch)
                        return response
                    } catch (err) {
                        err.status = false
                        return err
                    }
            },




}
   